package com.hmall.common.clients;

import com.hmall.common.dto.Item;
import com.hmall.common.dto.PageDTO;
import com.hmall.common.interceptors.FeignConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;


//@FeignClient(value = "itemservice",configuration = FeignConfig.class)
@FeignClient(value = "itemservice")
public interface ItemSearchClients {

    @GetMapping("/item/list")
    PageDTO<Item> getPage(@RequestParam Integer page, @RequestParam Integer size);

    @GetMapping("/item/{id}")
    Item getById(@PathVariable Long id);

    /**
     * 扣减商品库存的调用
     * @param itemId
     * @param num
     */
    @PutMapping("/item/stock/{itemId}/{num}")
    void deductItem(@PathVariable Long itemId,@PathVariable Integer num);
}
